import type { ThemeConfig } from 'antd'

export type ThemeMode = 'light' | 'dark'


const darkTheme: ThemeConfig = {
  token: {
    
    colorPrimary: '#1668dc',
    colorSuccess: '#10b981', // emerald-500
    colorWarning: '#f59e0b', // amber-500
    colorError: '#ef4444', // red-500
    colorInfo: '#3b82f6', // blue-500
    
    // 背景色
    colorBgContainer: '#1a1a1a',
    colorBgElevated: '#242424',
    colorBgLayout: '#0f0f0f',
    
    // 文字颜色
    colorText: 'rgba(255, 255, 255, 0.85)',
    colorTextSecondary: 'rgba(255, 255, 255, 0.65)',
    colorTextTertiary: 'rgba(255, 255, 255, 0.45)',
    colorTextQuaternary: 'rgba(255, 255, 255, 0.25)',
    
    // 边框颜色
    colorBorder: '#333333',
    colorBorderSecondary: '#2a2a2a',
    
    // Sider 主题（深色侧边栏）
    colorBgBase: '#242424',
    
    // 圆角
    borderRadius: 6,
    borderRadiusLG: 8,
    borderRadiusSM: 4,
    
    // 字体
    fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
    fontSize: 14,
  },
  components: {
    Layout: {
      bodyBg: '#0f0f0f',
      headerBg: '#1a1a1a',
      footerBg: '#1a1a1a',
      siderBg: '#242424',
    },
    Button: {
      primaryColor: '#fff',
    },
    Input: {
      colorBgContainer: '#1a1a1a',
      colorBorder: '#333',
      activeBorderColor: '#1668dc',
      hoverBorderColor: '#4080f0',
    },
    Select: {
      colorBgContainer: '#1a1a1a',
      colorBorder: '#333',
    },
    Slider: {
      railBg: '#2a2a2a',
      trackBg: '#1668dc',
      handleColor: '#1668dc',
    },
    Collapse: {
      colorBgContainer: 'transparent',
      colorBorder: '#333',
      colorTextHeading: 'rgba(255, 255, 255, 0.85)',
    },
  },
  algorithm: undefined,
}

// 亮色主题配置
const lightTheme: ThemeConfig = {
  token: {
    // 主色调 - 使用深蓝色系
    colorPrimary: '#1668dc',
    colorSuccess: '#10b981', 
    colorWarning: '#f59e0b',
    colorError: '#ef4444',
    colorInfo: '#3b82f6', 
    
    // 背景色
    colorBgContainer: '#ffffff',
    colorBgElevated: '#fafafa',
    colorBgLayout: '#f5f5f5',
    
    // 文字颜色
    colorText: 'rgba(0, 0, 0, 0.85)',
    colorTextSecondary: 'rgba(0, 0, 0, 0.65)',
    colorTextTertiary: 'rgba(0, 0, 0, 0.45)',
    colorTextQuaternary: 'rgba(0, 0, 0, 0.25)',
    
    // 边框颜色
    colorBorder: '#d9d9d9',
    colorBorderSecondary: '#f0f0f0',
    
    // Sider 主题（浅色侧边栏）
    colorBgBase: '#ffffff',
    
    // 圆角
    borderRadius: 6,
    borderRadiusLG: 8,
    borderRadiusSM: 4,
    
    // 字体
    fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
    fontSize: 14,
  },
  components: {
    Layout: {
      bodyBg: '#f5f5f5',
      headerBg: '#ffffff',
      footerBg: '#ffffff',
      siderBg: '#ffffff',
    },
    Button: {
      primaryColor: '#fff',
    },
    Input: {
      colorBgContainer: '#ffffff',
      colorBorder: '#d9d9d9',
      activeBorderColor: '#1668dc',
      hoverBorderColor: '#4080f0',
    },
    Select: {
      colorBgContainer: '#ffffff',
      colorBorder: '#d9d9d9',
    },
    Slider: {
      railBg: '#f5f5f5',
      trackBg: '#1668dc',
      handleColor: '#1668dc',
    },
    Collapse: {
      colorBgContainer: 'transparent',
      colorBorder: '#d9d9d9',
      colorTextHeading: 'rgba(0, 0, 0, 0.85)',
    },
  },
  algorithm: undefined,
}


export function getTheme(mode: ThemeMode = 'dark'): ThemeConfig {
  return mode === 'light' ? lightTheme : darkTheme
}


export const customTheme = darkTheme

